package com.util;

/**
 * 用来随机生成一个4位数的验证码
 */
public class AliyunCodeUtil {
    public static String getRandomCode(){
        String code = "";
        String str="123456789";
        for (int i = 0; i<4; i++){
          int num =(int) (Math.random()*str.length());
         code =code + str.charAt(num);
        }
        return "'"+code+"'";
    }

    public static void main(String[] args) {
        String randomCode = AliyunCodeUtil.getRandomCode();
        System.out.println(randomCode);

    }
}
